package com.lhz.framework.converter;

import cn.hutool.core.util.StrUtil;
import org.springframework.core.convert.converter.Converter;

import java.util.Date;

/**
 * 时间戳字符串转时间类型转换器
 * @author lihuazhi
 */
public class TimeStampToDateConverter implements Converter<String, Date> {

    @Override
    public Date convert(String text) {
        Date date = null;

        if (StrUtil.isNotEmpty(text)) {
            date = new Date(Long.parseLong(text));
        }

        return date;
    }
}